import { entrance, saveAdress,eCardInfo } from '~/service/entrance';
import { getDrawPrizeRecordAction } from './user';
const entranceAction = params => (dispatch, getState) => {
	return entrance(params).then(data =>(dispatch({
		type: 'entrance',
		payload: data
	})));
};

const grabGiftAction = params => (dispatch, getState) => {
	dispatch({
		type:'grab'
	});
	return Promise.resolve();
};

const saveAdressAction = params => (dispatch, getState) => {
	return saveAdress(params).then(()=>(dispatch(getDrawPrizeRecordAction())));
};

const eCardInfoAction = params => (dispatch, getState) => {
	return eCardInfo(params).then((ecard)=>(dispatch({
		type:'ecard',
		payload:{ecard}
	})));
};
export { grabGiftAction, saveAdressAction, eCardInfoAction };
export default entranceAction;
